<%--
  Created by IntelliJ IDEA.
  User: Kevin
  Date: 2021/6/2
  Time: 10:31
  To change this template use File | Settings | File Templates.
--%>
<%@page import="cn.kgc.pojo.*" %>
<%@page import="java.util.List" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1>购买商品</h1>
<form id="save" action="save" method="post">
    商品编号:
    <input type="text" name="id" value="" readonly="readonly">
    <br/>
    商品名称:
    <input type="text" name="name" readonly="readonly">
    <br/>
    商品分类:
    <input type="text" name="sortName" readonly="readonly">
    <br/>
    单价（元）:
    <input type="text" id="price" name="price" readonly="readonly">
    <br/>
    剩余数量：
    <input type="text" name="reamaining" readonly="readonly">
    <br/>
    购买数量：
    <input type="text" id="rx" name="rx" onchange="calc()" >
    <br/>
    总价：
    <input type="text" id="money" name="money" readonly="readonly" >
    <br/>
    <input type="submit" value="保存" class="save">
    &nbsp;&nbsp;
    <input type="reset" value="重置">
    &nbsp;&nbsp;
    <input type="button" value="返回" class="back">
</form>

<script type="application/javascript">
    function calc()
    {
        var x  = parseInt(document.getElementById("price").value);
        var y  = parseInt(document.getElementById("rx").value);
        var z = x * y;
        document.getElementById("money").value = z;
    }
</script>
</body>
</html>
